package db

import (
	"fmt"

	"github.com/jmoiron/sqlx"
)

var Db *sqlx.DB

//初始化
func Open() {
	database, err := sqlx.Open("mysql", "root:pw@tcp(127.0.0.1:3306)/blog?charset=utf8")

	if err != nil {
		fmt.Println("open mysql failed,", err)
		return
	}

	Db = database
}
